package com.mcp.converter.shared.response.analysis;

import lombok.Data;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 批量分析响应类
 * @author zengxiong
 */
@Data
public class BatchAnalysisResponse {
    private int totalCount;
    private int compatibleCount;
    private int incompatibleCount;
    private int errorCount;
    private List<AnalysisResponse> results = new ArrayList<>();
    private Map<Integer, String> errors = new HashMap<>();

    public void incrementCompatibleCount() {
        this.compatibleCount++;
    }

    public void incrementIncompatibleCount() {
        this.incompatibleCount++;
    }

    public void incrementErrorCount() {
        this.errorCount++;
    }

    public void addResult(int index, AnalysisResponse result) {
        while (results.size() <= index) {
            results.add(null);
        }
        results.set(index, result);
    }

    public void addError(int index, String error) {
        this.errors.put(index, error);
    }
}